<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="resource/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="resource/css/app.css" rel="stylesheet">
    <style>
      .input-append .add-on,.input-prepend .add-on {
    display: inline-block;
    width: auto;
    height: 20px;
    min-width: 16px;
    padding: 4px 5px;
    font-size: 14px;
    font-weight: normal;
    line-height: 20px;
    text-align: center;
    text-shadow: 0 1px 0 #fff;
    background-color: #eee;
    border: 1px solid #ccc
}

.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle {
    vertical-align: top;
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-radius: 0
}

.input-append .active,.input-prepend .active {
    background-color: #a9dba9;
    border-color: #46a546
}

.input-prepend .add-on,.input-prepend .btn {
    margin-right: -1px
}

.input-prepend .add-on:first-child,.input-prepend .btn:first-child {
    -webkit-border-radius: 4px 0 0 4px;
    -moz-border-radius: 4px 0 0 4px;
    border-radius: 4px 0 0 4px
}

.input-append input,.input-append select,.input-append .uneditable-input {
    -webkit-border-radius: 4px 0 0 4px;
    -moz-border-radius: 4px 0 0 4px;
    border-radius: 4px 0 0 4px
}

.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child {
    -webkit-border-radius: 0 4px 4px 0;
    -moz-border-radius: 0 4px 4px 0;
    border-radius: 0 4px 4px 0
}

.input-append .add-on,.input-append .btn,.input-append .btn-group {
    margin-left: -1px
}

.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle {
    -webkit-border-radius: 0 4px 4px 0;
    -moz-border-radius: 0 4px 4px 0;
    border-radius: 0 4px 4px 0
}
    </style>

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
  </head>
  <body class="bg-light-gray">
    
        <div class="input-append date form_datetime">
          <input size="16" type="hidden" id="mirror_field" name="time1" value="" >
          <input type="text" name="date" value="">
          <span class="add-on"><i class="icon-calendar glyphicon glyphicon-plus"></i></span>
          <span class="add-on"><i class="icon-remove  glyphicon glyphicon-minus"></i></span>
        </div>
        
       
               

      
    <script src="resource/js/vendor/jquery.min.js"></script>
    <script src="resource/js/vendor/bootstrap.min.js"></script>
    <script src="resource/js/component/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript">
      $(function() {
        var dateV = []
        $(".glyphicon-plus").datetimepicker({
            format: "yyyy-MM-dd",
            autoclose: true,
            todayBtn: true,
            minView: 'month',
            linkField: 'mirror_field',
            linkFormat: "yyyy-mm-dd"
        }).on("hide", function() {
          var value = $("input[name='time1']").val();
          dateV.push(value)
          $("input[name='date']").val(dateV)
        })

        $(".glyphicon-minus").on("click", function() {
          dateV.pop();
          $("input[name='date']").val(dateV)
        })


        // var valuearray = [];
        // $(".form_datetime").datetimepicker({
        //   format: 'yyyy-mm-dd',
        //   autoclose: true,
        //   language: 'zh-CN',
        //   todayBtn: 'linked',
        //   todayHighlight: true,
        //   pickerPosition: 'bottom-right',
        //   minView: 'month'
        // }).on("changeDate", function(ev) {
        //   var value = $("input[name='timeall']").val(new Date(ev.date.valueOf()));
        //   console.log(valuearray)
        //   $("input[name='time']").val(valuearray.push(value))
        // })

        // $(".glyphicon-minus").on("click", function(ev) {
          
        //   $("input[name='time']").val(valuearray.push(value))
        // })
      })
     
  </script>  
  </body>
</html>